      SUBROUTINE PLANETS1(TIMEPOCH,PLANELEMS,PERIOD,SUNMU)
      IMPLICIT REAL*8(A-H,O-Z)
C
C THIS ROUTINE INITIALIZES THE PLANET INITIAL CONDITIONS FOR USE
C BY THE PLANETS SUBROUTINE. IT RETURNS :
C
C   1. THE EPOCH COMMON TO ALL PLANET INITIAL CONDITIONS
C
C   2. THE PLANET INITIAL CONDITIONS. KEPLERIAN ELEMENTS IN HELIOCENTRIC
C      MEAN EARTH EQUATOR AND EQUINOX OF 1950.0
C
C   3. THE PERIOD OF THE PLANET IN SECONDS.
C
C   4. THE SUN MU VALUE CONSISTENT WITH THE ELEMENTS AND PERIOD
C
C**********************************************************************
C
C BY KAREN M. KEADLE, 8/83.
C     MODIFIED....    CJP, 12/84.....
C
C**********************************************************************
C 
C INFORMATION IS FROM THE EXPLANATORY SUPPLEMENT TO THE EPHEMERIS, 1961,
C THIRD PRINTING WITH AMMENDMENTS(1974).
C
      REAL*8 DEGRAD / 57.29588051308232D0 /
      REAL*8 TWOPI /  6.283185307179586D0 /
C
      PARAMETER NPLANETS=9
      REAL*8 PLANELEMS(6,NPLANETS)
      REAL*8 ELEMS(6,NPLANETS),PERIOD(NPLANETS)
      REAL*8 ELMERC(6), ELVENUS(6), ELEARTH(6), ELMARS(6), ELJUPI(6),
     *       ELSAT(6),  ELURAN(6),  ELNEPT(6),  ELPLUT(6)
C
      REAL*8 POSEPOCH(3),VELEPOCH(3),RTEMP(3),VTEMP(3),TOEQTL(3,3)
C
C PLANETARY ORBITAL ELEMENTS(HELIOCENTRIC) CORRESPONDING TO 
C JAN 1.5, 1960. THESE ARE FROM THE SUPPLEMENT, PAGE 491.
C
C ELEMENTS ARE: MEAN DISTANCE(AU), 
C               ECCENTRICITY, 
C               INCLINATION TO ECLIPTIC(DEG),
C               RIGHT ASCENSION OF THE ASCENDING NODE(DEG),
C               MEAN LONGITUDE OF PERIHELION(DEG, SEE SUPPLEMENT P112),
C               MEAN LONGITUDE(DEG, SEE SUPPLEMENT P112)
C
      REAL*8 EPOCH/600101.120000D0/
C
C   1 MERCURY.
      DATA ELMERC/0.387099, 0.205627, 7.00399, 
     *            47.85714D0, 76.83309D0, 222.62165D0/
C   2 VENUS
      DATA ELVENUS/0.723332, 0.006793, 3.39423,
     *             76.31972D0, 131.00831D0, 174.29431D0/
C   3 EARTH
      DATA ELEARTH/1.000000, 0.016726, 0.0, 
     *             0.0, 102.25253D0, 100.15815D0/
C   4 MARS
      DATA ELMARS/1.523691, 0.093368, 1.84991, 
     *            49.24903D0, 335.32269D0, 258.76729D0/
C   5 JUPITER
      DATA ELJUPI/5.202803, 0.048435, 1.30536, 
     *            100.04444D0, 13.67823D0, 259.83112D0/
C   6 SATURN
      DATA ELSAT/9.538843, 0.055682, 2.48991, 
     *           113.30747D0, 92.26447D0, 280.67135D0/
C   7 URANUS
      DATA ELURAN/19.181951D0, 0.047209, 0.77306, 
     *            73.79630D0, 170.01083D0, 141.30496D0/
C   8 NEPTUNE
      DATA ELNEPT/30.057779D0, 0.008575, 1.77375, 
     *            131.33980D0, 44.27395D0, 216.94090D0/
C   9 PLOTO
      DATA ELPLUT/39.43871D0, 0.250236, 17.1699D0, 
     *            109.88562D0, 224.16024D0, 181.64632D0/
C
C
C ELEMS ARRAY CONTAINS KEPLERIAN ELEMENTS FOR ALL OF THE PLANETS.
C
      EQUIVALENCE (ELEMS(1,1), ELMERC(1)),  (ELEMS(1,2), ELVENUS(1)),
     *            (ELEMS(1,3), ELEARTH(1)), (ELEMS(1,4), ELMARS(1)),
     *            (ELEMS(1,5), ELJUPI(1)),  (ELEMS(1,6), ELSAT(1)),
     *            (ELEMS(1,7), ELURAN(1)),  (ELEMS(1,8), ELNEPT(1)),
     *            (ELEMS(1,9), ELPLUT(1))
C
      REAL*8 AU/ 149.6D6 /           ! KM.  SUPPLEMENT, PAGE 490
C
C
      IBUG=0
      LUBUG=19
C
C SET THE SUN'S MU. PERIOD OF EARTH(HENCE, SUN'S) ORBIT IS ONE SIDEREAL
C YEAR SINCE WE CONSIDER THE EARTH ELEMENTS CONSTANT.
C
      SIDEYEAR = 365.25636D0 * 86400.D0  ! SUPPLEMENT, PAGE 488.
      PDEARTH = SIDEYEAR
      ERTSMA = ELEMS(1,3) * AU
      SUNMU = ERTSMA**3 / (PDEARTH/TWOPI)**2
C
C TIMEPOCH = NUMBER OF SECONDS FROM 1/1/50 TO EPOCH.
      TIMEPOCH=SINCE50(EPOCH)
C
C OBLIQUITY AT EPOCH.
      TILT=OBLIQ(TIMEPOCH)
C
C ROTN MATRIX FOR MEAN OF EPOCH ECLIPTIC TO MEAN OF EPOCH EQUATORIAL
      CALL ROT123(1,-TILT,0,0.D0,0,0.D0,TOEQTL,0,KDUM)
C
C
C ******************************
C *  LOOP THROUGH THE PLANETS  *
C ******************************
C
      DO 15 JPLANET=1,NPLANETS
      PLANELEMS(1,JPLANET) = ELEMS(1,JPLANET)*AU         ! TO KILOMETERS
      PLANELEMS(2,JPLANET) = ELEMS(2,JPLANET)
      DO I=3,6
        PLANELEMS(I,JPLANET) = ELEMS(I,JPLANET)/DEGRAD      ! TO RADIANS
        END DO
C
C    CONVERT MEAN LONGITUDE TO MEAN ANOMALY. SUPPLEMENT, PAGE 112.
      PLANELEMS(6,JPLANET) = PLANELEMS(6,JPLANET) - PLANELEMS(5,JPLANET)
C    CONVERT LONGITUDE OF PERIHELION TO ARGUMENT OF PERIHELION. PG 112.
      PLANELEMS(5,JPLANET) = PLANELEMS(5,JPLANET) - PLANELEMS(4,JPLANET)
C
C    PERIOD IN SECONDS
      PERIOD(JPLANET)= TWOPI * DSQRT(PLANELEMS(1,JPLANET)**3/SUNMU)
C
C    CONVERT KEPL PLANELEMS TO CART. HELIOCENTRIC MEAN OF EPOCH, ECLIP.
C
      CALL TOCART(SUNMU,PLANELEMS(1,JPLANET),0,POSEPOCH,VELEPOCH,6,IERR)
C
C    ROTATE POSITION AND VELOCITY VECTORS TO MEAN OF EPOCH, EQUATORIAL,
C    THEN TO MEAN OF 1950.0, EQUATORIAL. WHEN ROTATING THE VELOCITY
C    VECTOR, WE HAVE IGNORED THE MOTION OF THE MEAN OF EPOCH SYSTEM.
C
      CALL VECROT(TOEQTL,POSEPOCH,RTEMP)
      CALL VECROT(TOEQTL,VELEPOCH,VTEMP)
      CALL VECM50MDT(TIMEPOCH,-1,RTEMP,RTEMP) ! RTEMP NOW IN 1950.0
      CALL VECM50MDT(TIMEPOCH,-1,VTEMP,VTEMP) ! VTEMP NOW IN 1950.0
C
C    CONVERT CARTESIAN STATE TO KEPLERIAN ELEMENTS IN MEAN OF
C    1950.0 EQUATORIAL COORDINATES.
C
      CALL TOKEPL(SUNMU,RTEMP,VTEMP,PLANELEMS(1,JPLANET),DUM,DUM)
C
   15 CONTINUE
C
      RETURN
      END
